package com.zsk.blog.repository;


import com.zsk.blog.entity.Project;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface ProjectRepository extends JpaRepository<Project,Integer> {

    public List<Project> findAllByCompanyid(Integer companyId);

    public  List<Project> findAllByProjectrole(String projectrole);

    @Transactional()
    @Modifying
    @Query("update Project p set p.projectrole = ?2 where p.projectid = ?1")
    public Integer updatePasswordByUsername(Integer projectid, String projectrole);

}
